package com.jason.quectel;

/**
 * @author：Jason
 * @date：2022/3/8 14:10
 * @email：1129847330@qq.com
 * @description:
 */
public class OperationalCharactorDemo {
    public static void main(String[] args) {
        //System.out.println(~999);
        System.out.println(~-1);
        System.out.println(-1 & -2);
        System.out.println(-2 | -3);
        //System.out.println(2 & 3);
        //System.out.println(2 | 3);
        //System.out.println(7 & 8);
        //System.out.println(2 ^ 3);
        //System.out.println(7 ^ 8);
        //for (int i = -1; i > -100; i--) {
        //    System.out.println(~i);
        //}
        //System.out.println(8 << 2);
        //System.out.println("你 \b好,\n我是\rq\tu\te\tc\tt\te\tl\n\" \'\\");

        //System.out.println(Math.pow(2, 4));
        //System.out.println(Math.log(2));
        //for (int i = 0; i < 10; i++) {
        //    System.out.println(Math.random());
        //}
        //SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh-mm-ss E");
        //System.out.println(format.format(new Date()));
        ////int[] intArray=new int[3];
        //int[] intArray = new int[]{5, 1, 2, 3};
        //int[] intArray2 = new int[]{5, 1, 2, 3};
        ////Arrays.fill(intArray, 5);
        //for (int i : intArray) {
        //    System.out.print(i + " ");
        //}
        //System.out.println();
        //System.out.println(Arrays.equals(intArray, intArray2));
        //Arrays.sort(intArray);
        //System.out.println(Arrays.binarySearch(intArray, 5));
        //
        //int[][] intDoubleArray = new int[][]{{2, 3}, {4, 5}, {6, 7}};
        //for (int[] ints : intDoubleArray) {
        //    for (int anInt : ints) {
        //        System.out.print(anInt + " ");
        //    }
        //    System.out.println();
        //}


        //String content = "helloquectel";
        ////String pattern = ".*quectel.*";
        ////String pattern = "hello..quectel";
        ////String pattern = "hello[,.-]quectel";
        ////String pattern = "hello(,| |-)quectel";
        //String pattern = "hello(,| |-)?quectel";
        //boolean matches = Pattern.matches(pattern, content);
        //System.out.println("匹配结果：" + matches);

        //    有这样一个需求，需要获取一段代码的运行时间
        //calculateCodeRunTime(new CodeRunTimeCallback() {
        //    @Override
        //    public void runCode() {
        //        int sum = 0;
        //        for (int i = 1; i <= 100; i++) {
        //            try {
        //                Thread.sleep(10);
        //                sum += i;
        //            } catch (InterruptedException e) {
        //                e.printStackTrace();
        //            }
        //        }
        //    }
        //});
        //WashMachine washMachine = new WashMachine("小天鹅", 1280f);
        //washMachine.start();
    }

    public static long calculateCodeRunTime(CodeRunTimeCallback callback) {
        long startTime = System.currentTimeMillis();
        if (callback != null) {
            callback.runCode();
        }
        long endTime = System.currentTimeMillis();
        long result = endTime - startTime;
        System.out.println("共耗时：" + result);
        return result;
    }
}